from django.db import models
from django.contrib.auth.models import User



class Project(models.Model):
    """项目"""
    objects = models.QuerySet  # 将来会有用

    name = models.CharField("项目名称",max_length=32)
    intro = models.CharField("项目简介",max_length=256,default="")
    url = models.CharField("项目地址",max_length=256,default="")
    user_list = models.ManyToManyField(User,blank=True,related_name="project_set")  # 多对多关系，一个项目可以有多个人参加，一个人可以参加多个项目
    pm = models.ForeignKey(User,null=True,on_delete=models.SET_NULL,related_name="project_pm_list") # related_name 是为了和上面的区分，都关联了 User

class Config(models.Model):
    objects = models.QuerySet  # 将来会有用

    project = models.OneToOneField(Project, on_delete=models.CASCADE)
    conftest = models.TextField("pytest配置脚本",default="")

